package com.foreknow.service.impl;

import com.foreknow.dao.RegistLevelDao;
import com.foreknow.dao.RegistlevelMapper;
import com.foreknow.entity.RegistLevel;
import com.foreknow.entity.RegistlevelExample;
import com.foreknow.service.RegistLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class RegistLevelServiceImpl implements RegistLevelService {
    @Autowired
    private RegistlevelMapper registlevelMapper;
    @Autowired
    private RegistLevelDao registLevelDao;

    @Override
    public List<RegistLevel> selectByExample(RegistlevelExample example) throws Exception {

        return registLevelDao.queryRegistLevelForAll();
//        return registlevelMapper.selectByExample(example);
    }


    @Override
    public List<RegistLevel> queryRegistLevelForAll() throws Exception {
        RegistlevelExample example =new RegistlevelExample();
        return registlevelMapper.selectByExample(example);
    }

    @Override
    public int updateRegistLevel(RegistLevel registLevel) throws Exception {
        return registlevelMapper.updateByPrimaryKeySelective(registLevel);
    }

    @Override
    public int addRegistLevel(RegistLevel registLevel) throws Exception {
        return registlevelMapper.insertSelective(registLevel);
    }

    @Override
    public int deleteRegistLevel(Integer id) throws Exception {
        return registlevelMapper.deleteByPrimaryKey(id);
    }
}
